package com.ken.astroboy.model;

import java.util.ArrayList;
import java.util.List;

public class Contact {
		
	private String userName;
	private String nickName;
	private long memberCount;
	private List<Contact> memberList;
	private long chatRoomId;
	private String encryChatRoomId;
	private long verifyFlag;
	private long sex;
	private String province;
	private String city;
	private long attrStatus;
	private long uin;
	private String alias;
	private String displayName;
	
	
	public Contact() {
		memberCount = 0;
		memberList = null;
	}
	
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public long getMemberCount() {
		return memberCount;
	}
	public void setMemberCount(long memberCount) {
		this.memberCount = memberCount;
	}
	public List<Contact> getMemberList() {
		return memberList;
	}
	public void setMemberList(List<Contact> memberList) {
		this.memberList = memberList;
	}
	public long getChatRoomId() {
		return chatRoomId;
	}
	public void setChatRoomId(long chatRoomId) {
		this.chatRoomId = chatRoomId;
	}
	public String getEncryChatRoomId() {
		return encryChatRoomId;
	}
	public void setEncryChatRoomId(String encryChatRoomId) {
		this.encryChatRoomId = encryChatRoomId;
	}
	public long getVerifyFlag() {
		return verifyFlag;
	}
	public void setVerifyFlag(long verifyFlag) {
		this.verifyFlag = verifyFlag;
	}

	public long getSex() {
		return sex;
	}

	public void setSex(long sex) {
		this.sex = sex;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}
	
	public long getAttrStatus() {
		return attrStatus;
	}

	public void setAttrStatus(long attrStatus) {
		this.attrStatus = attrStatus;
	}

	public long getUin() {
		return uin;
	}

	public void setUin(long uin) {
		this.uin = uin;
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public String getDisplayName() {
		return displayName;
	}
	public void setDisplayName(String displayName) {
		this.displayName = displayName;
	}
	
	@Override
	public Contact clone() {	
		Contact contactNew = new Contact();
		
		contactNew.setUserName(userName);    
		contactNew.setNickName(nickName);       
		contactNew.setEncryChatRoomId(encryChatRoomId);
		contactNew.setProvince(province);       
		contactNew.setCity(city);           
		contactNew.setAlias(alias);          
		contactNew.setMemberCount(memberCount);    
		contactNew.setChatRoomId(chatRoomId);     
		contactNew.setVerifyFlag(verifyFlag);     
		contactNew.setSex(sex);            
		contactNew.setAttrStatus(attrStatus);     
		contactNew.setUin(uin); 
		contactNew.setDisplayName(displayName);
		contactNew.setMemberList(null);
		
		if(memberCount != 0){
			if(memberList != null){
				List<Contact> memberListNew = new ArrayList<>();
				
				for(Contact contact : memberList){
					memberListNew.add(contact.clone());
				}
				
				contactNew.setMemberList(memberListNew);
			}		
		}
		
		return contactNew;		
	}
	
	@Override
	public boolean equals(Object obj) {
		Contact m = (Contact) obj;		
		return ( this.userName.equals(m.userName) );
	}

	@Override
	public int hashCode() {
		return this.userName.hashCode();
	} 	
	
}
